package cn.stylefeng.guns.modular.business.frequency.financetransport.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.financetransport.service.FinanceTransportService;
import cn.stylefeng.guns.modular.business.frequency.financetransport.model.param.FinanceTransportParam;

import javax.annotation.Resource;

/**
 * 订单财务信息表 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:17
 */
@RestController
public class FinanceTransportController {

    @Resource
    private FinanceTransportService financeTransportService;

    /**
     * 分页查询订单财务信息表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @GetMapping("/financeTransport/page")
    @BusinessLog(title = "订单财务信息表_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(FinanceTransportParam financeTransportParam) {
        return new SuccessResponseData(financeTransportService.page(financeTransportParam));
    }

    /**
     * 获取全部订单财务信息表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @GetMapping("/financeTransport/list")
    @BusinessLog(title = "订单财务信息表_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(FinanceTransportParam financeTransportParam) {
        return new SuccessResponseData(financeTransportService.list(financeTransportParam));
    }

    /**
     * 查看详情订单财务信息表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @GetMapping("/financeTransport/detail")
    @BusinessLog(title = "订单财务信息表_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(FinanceTransportParam.detail.class) FinanceTransportParam financeTransportParam) {
        return new SuccessResponseData(financeTransportService.detail(financeTransportParam));
    }

    /**
     * 添加订单财务信息表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/financeTransport/add")
    @BusinessLog(title = "订单财务信息表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(FinanceTransportParam.add.class) FinanceTransportParam financeTransportParam) {
        financeTransportService.add(financeTransportParam);
        return new SuccessResponseData();
    }

    /**
     * 删除订单财务信息表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/financeTransport/delete")
    @BusinessLog(title = "订单财务信息表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(FinanceTransportParam.delete.class) FinanceTransportParam financeTransportParam) {
        financeTransportService.delete(financeTransportParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑订单财务信息表
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/financeTransport/edit")
    @BusinessLog(title = "订单财务信息表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(FinanceTransportParam.edit.class) FinanceTransportParam financeTransportParam) {
        financeTransportService.edit(financeTransportParam);
        return new SuccessResponseData();
    }


}
